Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow PDF capture in headful mode. #375

Merged
merged 1 commit into from
Oct 30, 2024

Conversation

rebeccacremona
Copy link
Contributor

Background

Our experiments, while limited, suggest that print-to-PDF works just fine with chromium in headful mode, even though Playwright's docs say, "Generating a pdf is currently only supported in Chromium headless", and their tests only check headless chromium

Digging through their codebase and git history, I was unable to uncover any information about why: there are no Github issues mentioning it being flaky/unreliable/buggy; there are no PRs adding "experimental support" or the like; the Chrome dev tools protocol doesn't mention any restrictions in its current verion OR in the oldest capture of that page in the Internet Archive...

I can see that the pdf method on Playwright's Page object is optional and may be undefined, but I see no evidence that, if the method is available, that it is sometimes unreliable or untrusted (e.g., if running chromium in headful mode).

And, indeed, there is a report from May 2020 where a user is complaining that page.pdf is throwing TypeError: page.pdf is not a function; they closed the issue when they heard that headful mode was not supported.

I think support for headful mode was added "by accident" due to some upstream change, and the docs and tests in the Playwright repo were never updated.

This PR

This PR removes the init check that disallows running Scoop with --pdf-snapshop and --headless false.

While it is certainly possible there is some good reason for not running that way, and further communication with the Playwright team will uncover why, it seems low-risk to enable for now... and perhaps collect our own data / watch for errors.

@rebeccacremona
Copy link
Contributor Author

(The Node 18 tests got hung up, so I canceled and re-ran them... looks good on this pass!)

@rebeccacremona rebeccacremona merged commit ecdd99b into harvard-lil:main Oct 30, 2024
6 checks passed
@rebeccacremona rebeccacremona deleted the headful-pdf-allowed branch October 30, 2024 17:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants